import 'package:flutter/material.dart';


class InputField {
  Widget inputField(TextEditingController controller,
      {IconData icon,
      String hintText,
      bool onScure = false,
      TextInputType textInputType = TextInputType.text,
      double right,
      double left}) {
    return Container(
      margin: EdgeInsets.fromLTRB(left ?? 28, 0, right ?? 28, 0),
      padding: EdgeInsets.fromLTRB(14, 0, 5, 0),
      decoration: new BoxDecoration(
        border: new Border.all(color: Colors.transparent, width: 0.5),
        // 边色与边宽度
        color: Color(0xFFECECFC),
        borderRadius: new BorderRadius.all(Radius.circular(180)), // 也可控件一边圆角大小
      ),
      child: TextField(
        controller: controller,
        decoration: InputDecoration(
            border: OutlineInputBorder(
              borderRadius: BorderRadius.circular(8.0),
              borderSide: BorderSide(color: Colors.transparent),
            ),
            contentPadding: EdgeInsets.all(15),
            disabledBorder: InputBorder.none,
            enabledBorder: InputBorder.none,
            focusedBorder: InputBorder.none,
            focusColor: Color(0xFF5464EC),
            isDense: true,
            icon: Icon(
              icon ?? Icons.person,
              size: 31,
              color: Color(0xFF5464EC),
            ),
            hintText: hintText,
            hintStyle: TextStyle(color: Color(0xFF5464EC))),
        style: TextStyle(fontSize: 16),
        cursorColor: Color(0xFF5464EC),
        obscureText: onScure,
        keyboardType: textInputType,
      ),
    );
  }
}
